package com.enthal.basicpers

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.net.ConnectivityManager
import android.net.wifi.WifiManager
import android.util.Log
import android.widget.Toast

class DynamicReceiver : BroadcastReceiver() {

    override fun onReceive(context: Context, intent: Intent) {
        Log.i(">> dBroadCast", intent.action)

        when (intent.action) {
            // 唤醒点亮屏幕
            Intent.ACTION_SCREEN_ON -> {
                Log.i("dPhoneStatus", "手机状态警告: 唤醒屏幕.")
            }

            // 关闭屏幕
            Intent.ACTION_SCREEN_OFF -> {
                Log.w("dPhoneStatus", "手机状态警告: 关闭屏幕.")
            }

            // 划开屏幕解锁
            Intent.ACTION_USER_PRESENT -> {
                Log.w("dPhoneStatus", "手机状态警告: 划开屏幕活跃状态.")
            }

            else-> Toast.makeText(context, "dBroadCast "+intent.action, Toast.LENGTH_LONG).show()
        }
    }
}
